package com.nineclock.system.feign;

import com.nineclock.common.entity.Result;
import com.nineclock.model.dto.SysCompanyUserDTO;
import com.nineclock.model.dto.SysUserDTO;
import com.nineclock.model.pojo.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("sys-system")
public interface SysUserFeign {
    @GetMapping("/user/query")
    public Result<SysUserDTO> queryUser(@RequestParam("username") String username);


    @GetMapping("/user/findById")
    public Result<SysCompanyUserDTO> findUserById(@RequestParam("userId") Long userId);

    //查询企业ID下的所有部门ID
    @GetMapping("/organization/department/top")
    public Result<List<Long>> queryDepartmentIds();

    /**
     * 查询指定部门集合下员工的数量
     */
    @GetMapping("/organization/department/membernum")
    public Result<Integer> queryUserCountByDepartmentId(@RequestParam("departmentIds") List<Long> departmentIds);

    /**
     * 根据员工id获得部门从低到高级别的部门ID数组
     * @param
     * @return
     */
    @GetMapping("/department/allDepId/{companyUserId}")
    public Result<List<Long>> queryDepartmentsByUserId(@PathVariable("companyUserId") Long companyUserId);

    @GetMapping("/companyUser/members")
    List<SysCompanyUserDTO> queryAllCompanyUser();


    //根据用户ID/企业ID动态查询员工列表数据
    @GetMapping("/companyUser/query")
    public Result<List<SysCompanyUserDTO>> queryCompanyUser(
            @RequestParam(value = "companyId", required = false) Long companyId,
            @RequestParam(value = "userId", required = false) Long userId);

    //根据企业ID查询企业的主管理员信息
    @GetMapping("/companyUser/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(@RequestParam(value = "companyId", required = false)Long companyId);

}